import java.math.BigInteger;
import java.util.*;

public class Quadratic {

    static class Table{
        int x;
        BigInteger n;
        BigInteger qx;
        int[] count;
        int[] mat;
        Table(int x, BigInteger n, BigInteger qx, int[] count, int[] mat){
            this.x = x;
            this.n = n;
            this.qx = qx;
            this.count = count;
            this.mat = mat;
        }
    }

    public static BigInteger[] quadratic(BigInteger number) {
        List<BigInteger> slist = new ArrayList<>();
        List<Table> result = new ArrayList<>();
        BigInteger sqrtn = mymath.BigSqrt(number);
        int[] S = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67};
        for(int i = 0; i < S.length; i++){
            if(mymath.Legendre(number, toBigInt(S[i])))
                slist.add(toBigInt(S[i]));
        }
        int size = 0, nc = 1;
        while(size < slist.size() + 2) {
            //BigInteger x = qlist.get(i);
            BigInteger x = qfx(toBigInt(nc), sqrtn, number);
            BigInteger tx = x;
            int[] ss = new int[slist.size()];
            int[] s = new int[slist.size()];
            int flag = 1;
            for(int j = 0; j < slist.size(); j++){
                BigInteger tmp = slist.get(j);
                int count = 0;
                while(x.mod(tmp).equals(BigInteger.ZERO)){
                    count ++;
                    x = x.divide(tmp);
                }
                ss[j] = count;
                if(count%2 != 0)
                    flag = 0;
                s[j] = count%2;
            }
            BigInteger xn = toBigInt(nc).add(sqrtn);
            if(flag == 1 && x.equals(BigInteger.ONE)){
                BigInteger qq = mymath.BigSqrt(tx);
                BigInteger re1 = mymath.BigGcd(number, xn.subtract(qq));
                if(re1.equals(BigInteger.ONE) || re1.equals(number))
                    re1 = mymath.BigGcd(number, xn.add(qq));
                BigInteger[] re = {re1, number.divide(re1)};
                return re;
            }
            if(x.equals(BigInteger.ONE)){
                Table table = new Table(nc, xn, tx, ss, s);
                result.add(table);
                size ++;
            }
            nc ++;
        }
        int[][] matrix = new int[result.size()][slist.size()];
        for(int i = 0; i < result.size(); i++){
            Table table = result.get(i);
            matrix[i] = table.mat;
        }
        int num = (int)Math.pow(2, matrix.length) - 1;
        for(int i = 1; i < num + 1; i++) {
            String bs = Integer.toBinaryString(i);
            int[] sum = new int[matrix[0].length];
            for(int j = 0; j < bs.length(); j++) {
                if(bs.charAt(j) == '1') {
                    for(int k = 0; k < matrix[0].length; k++)
                        sum[k] = (sum[k] + matrix[j][k])%2;
                }
            }
            int flag = 1;
            for(int k = 0; k < sum.length; k++)
                if(sum[k] == 1) {
                    flag = 0;
                    break;
                }
            if(flag == 1) {
                BigInteger ulti = BigInteger.ONE;
                BigInteger ultisqrt = BigInteger.ONE;
                for(int j = 0; j < bs.length(); j++) {
                    if(bs.charAt(j) == '1') {
                        ulti = ulti.multiply(result.get(j).qx);
                        ultisqrt = ultisqrt.multiply(result.get(j).n);
                    }
                }
                ulti = mymath.BigSqrt(ulti);
                BigInteger re1 = mymath.BigGcd(number, ultisqrt.subtract(ulti));
                if(re1.equals(BigInteger.ONE) || re1.equals(number))
                    re1 = mymath.BigGcd(number, ultisqrt.add(ulti));
                return new BigInteger[]{re1, number.divide(re1)};
            }
        }
        return new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO};
    }

    private static BigInteger qfx(BigInteger x, BigInteger sqrtn, BigInteger N) {
        return x.add(sqrtn).pow(2).subtract(N);
    }

    private static BigInteger toBigInt(int n) {
        return new BigInteger(new Integer(n).toString());
    }

    public static void main(String[] args){
        BigInteger[] re = quadratic(new BigInteger(args[0]));
        System.out.println(re[0] + " " + re[1]);
    }
    
}